<template>
	<el-container>
		<el-main class='x-main-edit'>
			<el-form ref="form" :rules="form_rules" :model="form" size="mini" label-width="15%">
				<el-tabs type="border-card" v-model="page_tag">
					<!---->
					<!---->
					<el-tab-pane :label="page_info.title" name="1">
						<el-form-item label="选择方式">
							<el-radio-group v-model="form.sel_type">
								<el-radio :key="0" :label="0">省</el-radio>
								<el-radio :key="1" :label="1">省市</el-radio>
							</el-radio-group>
						</el-form-item>
						<el-form-item v-show="form.sel_type==0" label="省" prop="mfcity_province">
							<CompSelectCity v-model="form.city" :get_city="0" :get_area="0"></CompSelectCity>
						</el-form-item>
						<el-form-item v-show="form.sel_type==1" label="省市" prop="mfcity_city">
							<CompSelectCity v-model="form.city" :get_area="0"></CompSelectCity>
						</el-form-item>
					</el-tab-pane>
					<!---->
					<!---->
					<el-tab-pane v-if="false" label="模板" name="2">
						<el-form-item label="应用模板" prop="reply_app_file" ref="reply_app_file">
							<el-col :span="6">
								<el-input v-model="form.reply_app_file" placeholder="默认：t_001"/>
							</el-col>
						</el-form-item>
					</el-tab-pane>
					<!---->
					<!---->
				</el-tabs>
			</el-form>
			<!---->
			<!---->
			<!-- 编辑控件 -->
			<!--			<PrizeSetList ref="item_edit" :id_src="form.fprize_uix" :pset_key="form.fprize_uix" app_id="fun_mall"></PrizeSetList>-->
			<!---->
			<!---->
			<!-- 按钮部分 -->
			<div class="save_wrap">
				<el-button @click="g_page.funcBack" size="mini">返回</el-button>
				<el-button type="success" @click="g_page.funcSave" size="mini">保存</el-button>
				<el-checkbox v-if="page_info.is_admin_edit" style="margin-left: 10px;" label="保存后停留" v-model="checked"/>
			</div>
			<!---->
			<!---->
			<!---->
		</el-main>
	</el-container>
</template>

<script>
	import CompSelectCity from '@/components/CompSelectCity'

	export default {
		components: {
			CompSelectCity
		},
		data() {
			let page_data = {
				set_stock: false
			}
			//
			page_data = this.g_cc.funcGetInitData(page_data)
			//
			return page_data
		},
		mounted() {
			console.log('mounted')
			console.log(this.$route.query)

			this.g_page.funcSetVue(this)
			//
			this.g_page.funcSetApiUrlEdit('/xadmin/mall/mall__freight__city__edit')
			this.g_page.funcSetApiUrlSave('/xadmin/mall/mall__freight__city__edit/save')
			let page = this
			//验证
			this.form_rules = {
				__test: [{
					required: true,
					message: '请输入原密码',
					trigger: 'blur'
				}]
			}

			let data = this.$route.query
			this.g_page.funcEdit(data)
		},
		methods: {
			funcShowDialogAfter() {
				console.log('funcShowDialogAfter')
			},
			//保存之前
			funcSaveBefore(data) {
				console.log('funcSaveBefore', data)

				if (data.city) {
					let arr_city = data.city.split(' ')
					data.mfcity_province = arr_city[0]
					data.mfcity_city = ''
					if (arr_city.length > 1) {
						data.mfcity_city = arr_city[1]
					}
				}

				return data
			}
		}
	}
</script>
